package com.gt.common;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;


public class JsonToXmlConverter {
    private static final XmlMapper xmlMapper = new XmlMapper();

    /**
     * json转xml
     * @param jsonString
     * @return
     * @throws Exception
     */
    public static String convertToXml(String jsonString) throws Exception {

        String xmlString = xmlMapper.writeValueAsString(new ObjectMapper().readTree(jsonString));

        return xmlString;
    }
}
